package com.example.mapper.aboutUser;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.pojo.aboutUser.RolePermissionRelation;
import com.example.pojo.aboutUser.SystemPermission;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface RolePermissionRelationMapper extends BaseMapper<RolePermissionRelation> {

    // 根据角色id查询出角色的所有权限
    @Select("SELECT p.* FROM system_permission p INNER JOIN role_permission_relation rp ON p.id = rp.permission_id WHERE rp.role_id = #{roleId}")
    List<SystemPermission> getPermissionsByRoleId(Integer roleId);

}

